import {formatDate} from '@angular/common';
import {Pipe, PipeTransform} from '@angular/core';
import {GnPipe} from './PipeTypes';

@GnPipe('datetime')
@Pipe({name: 'datetime'})
export class GnDateTimePipe implements PipeTransform {

  transform(value: any, format: string = 'yyyy-MM-dd HH:mm:ss'): string {
    if (!value) {
      return null;
    }
    return formatDate(value, format, 'zh-Hans');
  }
}
